/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package rg1oopdemo3;

import schoolpackage.HaveLessons;
import schoolpackage.Monitor;
import schoolpackage.Student;

/**
 *
 * @author apple
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Student mike=new Student("Mike", 18, 12345);
        System.out.println(mike.getName());
        System.out.println(Student.getClassName());
        mike.doHomework();
        
        Monitor joy=new Monitor("Joy", 19, 54321, " manage students", "123456789");
        System.out.println(Monitor.getClassName());
        System.out.println(joy.getName());
        joy.doHomework();
        joy.onDuty();
        
        System.out.println("-------------------------");
        System.out.println("");
        
        Student aStudent=joy;  //上转型对象
        System.out.println(aStudent.getName());
        aStudent.doHomework();
        if(aStudent instanceof Monitor)
        {
            ((Monitor)aStudent).onDuty();
        }
        
        //Monitor aMonitor=mike;
        System.out.println("-------------------------");
        System.out.println("");
        
    }
    
}
